oxenstored: do not commit read-only transactions
authorThomas Sanders <thomas.sanders@citrix.com>
Fri, 24 Mar 2017 16:16:10 +0000 (16:16 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 5 Apr 2017 14:10:42 +0000 (15:10 +0100)
commit84ee808e363887910984b3eb443466ce42e8010f
tree2d6716faa24fc93a2b3a7c101b83c0f8f64ce51f
parentcb778dee017504505a5f20aea1831abef31a3e97
oxenstored: do not commit read-only transactions

The packet telling us to end the transaction has always carried an
argument telling us whether to commit.

If the transaction made no modifications to the tree, now we ignore
that argument and do not commit: it is just a waste of effort.

This makes read-only transactions immune to conflicts, and means that
we do not need to store any of their details in the history that is
used for assigning blame for conflicts.

We count a transaction as a read-only transaction only if it contains
no operations that modified the tree.

This means that (for example) a transaction that creates a new node
then deletes it would NOT count as read-only, even though it makes no
change overall. A more sophisticated algorithm could judge the
transaction based on comparison of its initial and final states, but
this would add complexity and computational cost.

Reported-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
Reviewed-by: Jonathan Davies <jonathan.davies@citrix.com>
tools/ocaml/xenstored/process.ml
tools/ocaml/xenstored/transaction.ml